//
//  YZPigDocBaseInfoViewModel.m
//  VET
//
//  Created by YZ on 2018/7/19.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZPigDocBaseInfoViewModel.h"
#import "YZPigDocBaseInfoModel.h"
#import "NSDate+Category.h"

@implementation YZPigDocBaseInfoViewModel

@synthesize dataSource = _dataSource;

- (instancetype)init
{
    if(self = [super init]){
        [self config];
    }
    return self;
}

- (void)config
{
//    YZPigDocBaseInfoModel *earModel = [YZPigDocBaseInfoModel new];
//    earModel.title = @"耳标号";
//    earModel.content = @"200010";
//    
//    YZPigDocBaseInfoModel *earNumModel = [YZPigDocBaseInfoModel new];
//    earNumModel.title = @"耳标";
//    earNumModel.content = @"未填写";
//    
//    YZPigDocBaseInfoModel *typeModel = [YZPigDocBaseInfoModel new];
//    typeModel.title = @"分类";
//    typeModel.content = @"种猪";
//    
//    YZPigDocBaseInfoModel *sexModel = [YZPigDocBaseInfoModel new];
//    sexModel.title = @"性别";
//    sexModel.content = @"公猪";
//    
//    YZPigDocBaseInfoModel *categoryModel = [YZPigDocBaseInfoModel new];
//    categoryModel.title = @"品种";
//    categoryModel.content = @"杜洛克";
//    
//    YZPigDocBaseInfoModel *birthModel = [YZPigDocBaseInfoModel new];
//    birthModel.title = @"出生日期";
//    birthModel.content = @"2018-02-23";
//    
//    YZPigDocBaseInfoModel *dateModel = [YZPigDocBaseInfoModel new];
//    dateModel.title = @"日龄 (天)";
//    dateModel.content = @"324";
//    
//    YZPigDocBaseInfoModel *statusModel = [YZPigDocBaseInfoModel new];
//    statusModel.title = @"当前状态";
//    statusModel.content = @"后备";
//    
//    _dataSource = @[@[earModel,earNumModel,typeModel,sexModel,categoryModel,birthModel,dateModel,statusModel]];
}

- (void)setModel:(YZPigModel *)model
{
    _model = model;
    YZPigDocBaseInfoModel *earModel = [YZPigDocBaseInfoModel new];
    earModel.title = @"耳标号";
    earModel.content = model.earMark;
    
    YZPigDocBaseInfoModel *earNumModel = [YZPigDocBaseInfoModel new];
    earNumModel.title = @"耳标";
    earNumModel.content = model.earNumber;
    
    YZPigDocBaseInfoModel *typeModel = [YZPigDocBaseInfoModel new];
    typeModel.title = @"分类";
    typeModel.content = model.swineClass.itemValue;
    
    YZPigDocBaseInfoModel *sexModel = [YZPigDocBaseInfoModel new];
    sexModel.title = @"性别";
    sexModel.content = model.swineSex.itemValue;
    
    YZPigDocBaseInfoModel *categoryModel = [YZPigDocBaseInfoModel new];
    categoryModel.title = @"品种";
    categoryModel.content = model.swineSpecies.itemValue;
    
    YZPigDocBaseInfoModel *birthModel = [YZPigDocBaseInfoModel new];
    birthModel.title = @"出生日期";
    birthModel.content = [[NSDate dateWithTimeIntervalSince1970:model.swineBirthdate] localDateString];
    
    YZPigDocBaseInfoModel *dateModel = [YZPigDocBaseInfoModel new];
    dateModel.title = @"日龄 (天)";
    dateModel.content = model.pigBirthdateStr;
    
    YZPigDocBaseInfoModel *statusModel = [YZPigDocBaseInfoModel new];
    statusModel.title = @"当前状态";
    statusModel.content = model.swineState.itemValue;
    
    _dataSource = @[@[earModel,earNumModel,typeModel,sexModel,categoryModel,birthModel,dateModel,statusModel]];
    
}
@end
